﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _48_Rotate
{
    class Program
    {
        static void Main(string[] args)
        {
            int[,] matrix = new int[,] { { 1, 2 }, { 3, 4 }, { 5, 6 }, { 7, 8 } };

            int i = matrix.Length;

            
        }

        public void Rotate(int[,] matrix)
        {
            for (int i = 0; i < matrix.GetLength(0); i++)
            {
                for (int j = 0; j < matrix.GetLength(1); j++)
                {
                    int temp = 0;
                    temp = matrix[i, j];
                    matrix[i, j] = matrix[j, i];
                    matrix[j, i] = temp;
                }
            }
            for (int i = 0; i < matrix.Length; i++)
            {
                for (int j = 0; j < matrix.Length / 2; j++)
                {
                    int temp = 0;
                    temp = matrix[i, j];
                    matrix[i, j] = matrix[i, matrix.Length - 1 - j];
                    matrix[i, matrix.Length - 1 - j] = temp;
                }
            }
        }
    }
}
